#syntax=docker/dockerfile:1.3-labs
ARG IMAGE_REPO=docker.io/library
ARG JDK_VERSION=1.8
# From JDK
FROM ${IMAGE_REPO}/jdk-devel:${JDK_VERSION}  
ARG SCALA3_VERSION=3.2.2
ENV SCALA_HOME=/opt/scala
ENV PATH=$PATH:$SCALA_HOME/bin 
RUN curl -LO https://github.com/lampepfl/dotty/releases/download/${SCALA3_VERSION}/scala3-${SCALA3_VERSION}.tar.gz && \
    mkdir -p ${SCALA_HOME} && \
    tar -zxvf scala3-${SCALA3_VERSION}.tar.gz --strip-components=1 -C ${SCALA_HOME} && \
    rm -f scala3-${SCALA3_VERSION}.tar.gz
RUN \
    echo "SCALA_HOME=${SCALA_HOME}" >>/root/.bashrc && \
    sed -i "$(awk '/export PATH=.*/{print NR}' ~/.bashrc)s,.*,export PATH=${PATH},g" /root/.bashrc
# CMD [ "/usr/sbin/sshd" ]
